<template>
	<view>
		<!-- 导航栏 -->
		<!-- <u-tabbar :value="current?current:0" @change="change1" :fixed="true" :placeholder="true"
			:safeAreaInsetBottom="true">
			<u-tabbar-item v-for="(item,index) in list" :key="index" :text="item.text" :icon="item.icon"
				@click="click1(index)">
			</u-tabbar-item>
		</u-tabbar> -->
		<u-tabbar :value="current ? current: 0" @change="change1" :fixed="true" :placeholder="false"
			:safeAreaInsetBottom="false">
			<u-tabbar-item v-for="(item,index) in list" :key="index" :text="item.text" :icon="item.icon"
				@click="click1(index)">
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		text: "custom-tabbar",
		props: {
			current: Number
		},
		data() {
			return {

				list: [{
					pagePath: '/pages/index/index',
					text: '首页',
					icon: 'home'
				}, {
					pagePath: '/pages/selected/selected',
					text: '社区',
					icon: 'eye'
				}, {
					pagePath: '/pages/foods/foods',
					text: '食物库',
					icon: 'list'

				}, {
					pagePath: '/pages/user/user',
					text: '我的',
					icon: 'account'
				}]
			};
		},
		methods: {
			change1(e) {
				console.log(e);
				uni.switchTab({
					url: this.list[e].pagePath
				})
			},
			click1(index) {
				// this.value1 = index

			}
		}
	}
</script>

<style lang="scss">

</style>
